﻿@model List<FShare.ViewModels.UploadedFileViewModel>

@{
    ViewBag.Title = "My Files | FShare";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Display uploaded files</h2>

<p>Displaying uploaded files of <span class="file-info">@User.Identity.Name</span>.</p>
<p>Total uploaded files: <span class="file-info">@Model.Count</span></p>

<table>
<colgroup>
    <col />
    <col />
    <col />
    <col />
    <col />
</colgroup>
<thead>
    <tr>
        <th>File name</th>
        <th>Description</th>
        <th>Date uploaded</th>
        <th>Downloads</th>
        <th>Control</th>
    </tr>
</thead>
<tbody>
@using (Html.BeginForm())
{
    foreach (var file in Model)
    {
    <tr>
        <td class="file-name">@file.FileName</td>
        <td class="file-description">@file.Description</td>
        <td class="file-upload-time">@file.UploadedTime.ToShortDateString()</td>
        <td class="file-download-times">@file.NumberOfDownloads</td>
        <td class="file-control">
            [@Html.ActionLink("Delete", "Delete", "Files", new { id = file.DeleteSecret }, null)]
            [@Html.ActionLink("Download", "Download", "Files", new { id = file.DownloadSecret }, null)]
        </td>
    </tr>
    }
}
</tbody>
</table>
